<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%@ page import="com.colabo.j2ee.web.oaf.monitorperspective.action.AccessMonitorViewAction" 
%>
<%	
	String pageNo = "1";
	String perpage = "10";
	if (request.getParameter("page") != null && !request.getParameter("page").equals("NaN")){
		pageNo = request.getParameter("page");
	}
	if (request.getParameter("perpage") != null) {
		perpage = request.getParameter("perpage");
	} 
	AccessMonitorViewAction action = new AccessMonitorViewAction();
	String logDataJson = action.loadLogData(pageNo, perpage);
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Access Monitor View</title>
<script type="text/javascript">

	
    function onGridSelect(evt){
        var str = 'row: ' + evt.row + ' indices: ' + evt.indices;
        str += ' id: ' + evt.target.getDataByRow(evt.row).auditlogky;
        alert(str);
    }

    function gridButtonClick(button, grid){
        alert(button);
    }

    var cmu = [{
        header: '业务模块',
        dataIndex: 'bizType',
        dataType: 'string',
        width: 100
    },
    {
        header: '操作类型',
        dataIndex: 'logType',
        dataType: 'string',
        width: 100
    },
    {
        header: '用户名',
        dataIndex: 'opCode',
        dataType: 'string',
        width: 60
    },
    {
        header: '发生日期',
        dataIndex: 'logTime',
        dataType: 'string',
        width: 200
    },
	{
    	header: 'IP地址',
        dataIndex: 'ipAddr',
        dataType: 'string',
        width: 100
    },
    {
        header: '日志级别',
        dataIndex: 'logLevel',
        dataType: 'string',
        width: 60
    },
    {
        header: '日志内容',
        dataIndex: 'logInfo',
        dataType: 'string',
        width: 100
    }
    ]; 

    // using 'load' instead of 'domready' for IE8 
	    var datagrid = new omniGrid('logDataGrid', {
	        columnModel: cmu,
	        url: '<%=request.getContextPath()%>' + '/monitorperspective/logdatagridProvider.jsp',
	        perPageOptions: [10, 20, 50, 100, 200],
	        perPage: 10,
	        page: 1,
	        pagination: true,
	        serverSort: true,
	        showHeader: true,
	        alternaterows: true,
	        showHeader: true,
	        sortHeader: false,
	        resizeColumns: true,
	        multipleSelection: false,
	        width: 900,
	        height: 295,
	        pkeyfield:'auditlogky'
	    });
    	datagrid.addEvent('click', onGridSelect);

</script>
</head>
<body>
<div id="logDataGrid" ></div>
</body>
</html>